package com.dcjt.firehotcarpad.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckedTextView;
import android.widget.Filterable;
import android.widget.TextView;
import android.widget.ThemedSpinnerAdapter;

import com.aries.ui.view.radius.RadiusTextView;
import com.dcjt.firehotcarpad.R;
import com.dcjt.firehotcarpad.entity.JigouDetailEntity;

import java.util.List;

public class MySpinnerAdapter extends BaseAdapter {
    private Context context;

    private List<JigouDetailEntity> lists;


    public MySpinnerAdapter(Context context, List<JigouDetailEntity> lists) {

        this.context = context;

        this.lists = lists;

    }
    @Override
    public int getCount() {
        return lists.size();
    }

    @Override
    public Object getItem(int position) {
        if (lists.size() >0){
            return lists.get(position);
        }
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view =

        LayoutInflater.from(context).inflate(R.layout.item_spinner_text, null);

        TextView tv_zlb = (TextView) view.findViewById(R.id.ctv);

        tv_zlb.setText(lists.get(position).getFull_name());

        tv_zlb.setSingleLine();

        tv_zlb.setEllipsize(TextUtils.TruncateAt.END);

        return view;
    }

    public void  setNewList(List<JigouDetailEntity> list){
        this.lists = list;
    }
    public List<JigouDetailEntity>  getSinnerData(){
       return  this.lists;
    }
    public void  addDataIndex(JigouDetailEntity detailEntity,int index){
        this.lists.add(index,detailEntity);
    }


}
